package fragment;

import android.content.Intent;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.sam.ui.base.activity.BaseFragmentActivity;
import com.sam.ui.base.fragment.BaseFragment;
import com.sam.ui.base.fragment.BaseParentFragment;
import com.sam.widget.headerBar.LeftImgSegmentedRightImgBar;
import com.sam.widget.segmented.OnSegmentCheckedChangeListener;
import com.sam.widget.segmented.SegmentedBar;

import base.WonderBaseFragment;
import wonder.com.basketballdemo.R;

/**
 * Created by Administrator on 2016/7/13.
 */
public class WonderFragment extends BaseParentFragment {
    private LeftImgSegmentedRightImgBar segmentedBar;
    public static WonderFragment self;

    public synchronized static WonderFragment getInstanse() {
        if (self == null) self = new WonderFragment();
        return self;
    }
    private TextView tv;
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        ;
        super.onCreate(savedInstanceState);
        setContentView(R.layout.wonder_fragment);
    }
    protected void findView() {
        segmentedBar = (LeftImgSegmentedRightImgBar) findViewById(R.id.segmentedBar);

    }

    @Override
    public void showFragment(@IdRes int containerResId, Fragment fragment) {
        super.showFragment(containerResId, fragment);
    }

    protected void initView() {
        segmentedBar.setSegmentInfo(new String[]{"精彩瞬间", "我的圈子"}, 0, onSegmentCheckedChangeListener);
    }

    OnSegmentCheckedChangeListener onSegmentCheckedChangeListener = new OnSegmentCheckedChangeListener() {
        @Override
        public void onSegmentCheckedChanged(ViewGroup viewGroup, int i, TextView textView) {
            switch (i) {
                case 0:
                    showFragment(R.id.wonderful_replace,WonderfulFragment.getInstance());
                    break;
                case 1:
                    showFragment(R.id.wonderful_replace,MyCercelFragment.getInstance());
                    break;
            }
        }
    };
}
